#include <ApiService.h>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <framelesswindow.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    auto icon = QIcon(":/logo.ico");
    QGuiApplication::setWindowIcon(icon);
    QQmlApplicationEngine engine;
    const QUrl url(u"qrc:/music_player/main.qml"_qs);
    // qmlRegisterType<FramelessWindow>("qc.window",1,0,"FramelessWindow");

    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);

    engine.loadFromModule("music_player", "Main");
    auto *apiService = engine.singletonInstance<ApiService *>(
        "music_player", "ApiService");
    return app.exec();
}
